package com.eastfair.builder.service.impl;

import com.eastfair.builder.service.BuilderDrawingService;
import com.eastfair.builder.service.BuilderReportDrawingAuditHistoryService;
import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.api.ReportDrawingAuditHistoryFeign;
import com.eastfair.home.vo.ReportDrawingAuditHistoryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 报馆图纸审核历史服务.
 *
 * @author dqq
 * @date 2022 /8/22
 */
@Service
@Slf4j
public class BuilderReportDrawingAuditHistoryServiceImpl implements BuilderReportDrawingAuditHistoryService {

    @Resource
    private ReportDrawingAuditHistoryFeign reportDrawingAuditHistoryFeign;

    @Override
    public List<ReportDrawingAuditHistoryVO> queryByReportDrawingCategoryAuditHistoryId(Long reportDrawingCategoryAuditHistoryId) {
        R<List<ReportDrawingAuditHistoryVO>> result
                = reportDrawingAuditHistoryFeign.queryByReportDrawingCategoryAuditHistoryId(reportDrawingCategoryAuditHistoryId);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}